class StairRenderer : public IBlockRenderer
{
public:
	ITexture *Texture;
	Point2i TexturePosition;

	StairRenderer(ITexture *texture, const Point2i &texPos) :
		Texture(texture),
		TexturePosition(texPos)
	{
	}

	int GetTypeData(const int &data) { return 0; }

	void Render(Schematic *schematic, RendererBase *renderer, const Block &block, const Point3i &position)
	{
		byte d = (byte)(block.Data & ~0x04);
		bool upsidedown = (block.Data & 0x04) != 0;

		Box flat(Texture, Point3i(16, 8, 16), Point3i(0, 8, 0));
		Box side(Texture);

		switch (d)
		{
		case 0:
			side.Bounds = Point3i(8, 8, 16);
			side.Position = Point3i(8, 0, 0);
			break;
		case 1:
			side.Bounds = Point3i(8, 8, 16);
			side.Position = Point3i(0, 0, 0);
			break;
		case 2:
			side.Bounds = Point3i(16, 8, 8);
			side.Position = Point3i(0, 0, 8);
			break;
		case 3:
			side.Bounds = Point3i(16, 8, 8);
			side.Position = Point3i(0, 0, 0);
			break;
		}

		if (upsidedown)
		{
			flat.Position.Y = 0;
			side.Position.Y = 8;
		}

		flat.SetCoordsFromBounds(TexturePosition);
		side.SetCoordsFromBounds(TexturePosition);

		renderer->Draw(flat);
		renderer->Draw(side);
	}
};